If Statement Page

An if statement is how programs will make decisions. The best way to think about if statements would be to think of them as a series of true or false questions. An if can be expanded by requiring other conditions, we call this an else if statement. Below is an example of how to use if statements in C.

This is example of the code used to show how if statements are used. It begins by setting the variables, then asks the user for input and checks the total of the two variables and shows a different message if one is true.